<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const nums = {
            name: 'yuzelin',
            score: 99,
            students: [
                {
                    name: 'fangyunchuan',
                    score: 100,
                },
                {
                    name: 'zenghonggui',
                    score: 120,
                },
                {
                    name: 'junge',
                    score: 190,
                    students: [
                        {
                            name: 'chenwen',
                            score: 220,
                        },
                        {
                            name: 'zhongge',
                            score: 110,
                        },
                    ],
                },
            ],
        };

        let sum = 0;
        function getSum(obj) {
            sum += obj.score;
             for (const child of obj.students || []) {
                getSum(child);
             }
             return sum;
         }
         console.log(getSum(nums));
    </script>
    </script>
</body>

</html>